package co.yixiang.modules.system.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import lombok.Builder;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.*;
import java.time.LocalDateTime;
import java.io.Serializable;

/**
* @author zf
* @date 2021-07-10
*/
@Data
@Accessors(chain = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("loan_package")
public class LoanPackage implements Serializable {

    @TableId
    private Integer id;


    /** 产品名称 */
    @NotBlank
    private String name;


    /** 月息 */
    @NotBlank
    private String interest;


    /** 期限 */
    @NotBlank
    private String term;


    /** 最高可贷额 */
    private String loanableMax;


    /** 贷款类型 */
    @NotNull
    private Integer type;


    /** 还款方式 */
    @NotBlank
    private String repayment;


    /** 最低可贷额 */
    private String loanableMin;


    /** 产品特征 */
    private String features;


    /** 申请条件 */
    private String conditions;


    /** 所需材料 */
    private String stuff;


    @TableField(fill= FieldFill.INSERT)
    private LocalDateTime createTime;


    public void copy(LoanPackage source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
